package com.mobile.service.enums;

/**
 * 工单状态枚举
 */
public enum WorkOrderStatus {
    SUBMITTED("SUBMITTED", "已申报"),
    AUDITING("AUDITING", "审核中"),
    RE_DISPATCH("RE_DISPATCH", "待重分派"),
    COMPLETED("COMPLETED", "已完成"),
    NEED_CORRECT("NEED_CORRECT", "需补正"),
    COLLABORATING("COLLABORATING", "协办中"),
    REJECTED("REJECTED", "已驳回");

    private final String code;
    private final String description;

    WorkOrderStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static WorkOrderStatus fromCode(String code) {
        for (WorkOrderStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown status code: " + code);
    }
}